#Toplevel Makefile for compiling salil64

SOURCES=arch/boot.o arch/print.o arch/page.o arch/tables.o arch/main.o lib/bitmap.o lib/string.o lib/kprint.o kernel/pagealloc.o kernel/main.o kernel/vmalloc.o

AS=nasm
ASFLAGS=-felf64

CC=gcc
CFLAGS=-m64 -ffreestanding -nostdlib -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -Iinclude -c -O2

LDFLAGS=-Tlink.ld -nostdlib -nodefaultlibs

all: $(SOURCES)
	ld $(LDFLAGS) -o salil64 $(SOURCES)

.c.o:
	$(CC) $(CFLAGS) -o $@ $<

.s.o:
	$(AS) $(ASFLAGS) -o $@ $<

clean:
	find . -name '*.o' -print0 | xargs -0 rm
